package demo;

public class Test {
    public static void main(String[] args) {

    }
    public static void main3(String[] args) {
        Cat cat = new Cat(7,"小猫") {
            @Override
            public void catEat() {
                System.out.println(this.str + "  正在吃饭哦");
            }
        };
        cat.catEat();
    }


    public static void main2(String[] args) {
        Dog dog = new Dog("旺财",12);
        dog.x = 10;
        System.out.println(dog.x);
    }
    public static void main1(String[] args) {
        Dog dog = new Dog("旺财",8);
        dog.eat();
        dog.brak();
        Animal dog1 = new Dog("小黄",7);
        dog1.eat();
        Animal bird = new Bird("黑毛",5);
        if(bird instanceof Bird){
            Bird bird1 =(Bird) bird;
            bird1.chirp();
        }
    }
}
